<template>
	<view class="workbench">
		<view class="header-swiper">
			<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
				:duration="duration">

				<!-- 积分兑换 -->
				<swiper-item>
					<view class="swiper-item-view" @click.stop="goLottery">
						<image class="swiper-image" src="https://biapi.vaubang.cn/UploadFiles/Images/integral.png"
							mode="aspectFill"></image>
					</view>
				</swiper-item>

			</swiper>
		</view>

		<!-- 功能模块导航 -->
		<view class="nav-function-box">
			<view class="nav-function-item" @click="goHandleTask">
				<view class="nav-icon-box bg0"></view>
				<text class="nav-item-text">日常任务</text>
			</view>
			<view class="nav-function-item" @click="handleGoImportPath">
				<view class="nav-icon-box bg5"></view>
				<text class="nav-item-text">自定义任务</text>
			</view>
			<view class="nav-function-item">
				<view class="nav-icon-box bg6"></view>
				<text class="nav-item-text">活动立项</text>
			</view>
			<view class="nav-function-item">
				<view class="nav-icon-box bg3"></view>
				<text class="nav-item-text">卡券管理</text>
			</view>
			<view class="nav-function-item" @tap="handleGoWxReecord">
				<view class="nav-icon-box bg7"></view>
				<text class="nav-item-text">招揽记录</text>
			</view>
			<view class="nav-function-item">
				<view class="nav-icon-box bg8"></view>
				<text class="nav-item-text">招揽结果</text>
			</view>
			<view class="nav-function-item">
				<view class="nav-icon-box bg9"></view>
				<text class="nav-item-text">招揽成效</text>
			</view>
			<view class="nav-function-item">
				<view class="nav-icon-box bg10"></view>
				<text class="nav-item-text">优惠券到期</text>
			</view>
			<view class="nav-function-item">
				<view class="nav-icon-box bg11"></view>
				<text class="nav-item-text">过程点检</text>
			</view>
			<view class="nav-function-item" @click="handleGoAboutSee">
				<view class="nav-icon-box bg12"></view>
				<text class="nav-item-text">预约看板</text>
			</view>

		</view>
		<auth-modal v-if="!isLogin"></auth-modal>
		<!-- 必须添加tabsTaskList有数据的条件判断，否则样式错误 -->
		<van-tabs v-if="isLogin && tabsTaskList.length > 0" :ellipsis="false" :scrollspy="true" :animated="true"
			ref="tabs" class="task_tabs" color="#008aff">
			<van-tab v-for="(item, index) in tabsTaskList" :title="item.type" :key="index" :name="item.type">
				<view class="task_detail">
					<view class="task_number_item" v-for="(taskInfoItem, taskInfoIndex) in tabsTaskInfoList[index]"
						:key="taskInfoIndex">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">{{ taskInfoItem.name }}</view>
						</view>
						<view @tap="goPageLink(item)" class="number_item_right">
							<view class="right_text" :class="{ right_text_color: taskInfoItem.name==='未完成' }">
								{{ taskInfoItem.value ? taskInfoItem.value : 0 }}
							</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>

				</view>
			</van-tab>
		</van-tabs>

		<!-- 没有值是显示 -->
		<van-tabs v-if="isLogin && tabsTaskList.length === 0" :ellipsis="false" :scrollspy="true" :animated="true"
			ref="tabs" class="task_tabs" color="#008aff">
			<van-tab title="常规招揽" name="常规招揽">
				<view class="task_detail">
					<!-- 任务数 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">任务数</view>
						</view>
						<view @tap="goPageLink" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 已完成 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">已完成</view>
						</view>
						<view @tap="goPageLink" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 成功 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">成功</view>
						</view>
						<view @tap="goPageLink" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 继续 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">继续</view>
						</view>
						<view @tap="goPageLink" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 战败 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">战败</view>
						</view>
						<view @tap="goPageLink" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 未完成 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">未完成</view>
						</view>
						<view @tap="goPageLink" class="number_item_right">
							<view class="right_text right_text_color">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
				</view>
			</van-tab>

			<van-tab title="自定义导入" name="自定义导入">
				<view class="task_detail">
					<!-- 任务数 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">任务数</view>
						</view>
						<view @tap="goPageLink('自定义导入')" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 已完成 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">已完成</view>
						</view>
						<view @tap="goPageLink('自定义导入')" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 成功 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">成功</view>
						</view>
						<view @tap="goPageLink('自定义导入')" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 继续 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">继续</view>
						</view>
						<view @tap="goPageLink('自定义导入')" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 战败 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">战败</view>
						</view>
						<view @tap="goPageLink('自定义导入')" class="number_item_right">
							<view class="right_text">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
					<!-- 未完成 -->
					<view class="task_number_item">
						<view class="number_item_left">
							<view class="left_img">
								<image class="ellipse_image" src="../../static/Ellipse_1.png"></image>
							</view>
							<view class="left_text">未完成</view>
						</view>
						<view @tap="goPageLink('自定义导入')" class="number_item_right">
							<view class="right_text right_text_color">0</view>
							<view class="right_img">
								<image class="vector_image" src="../../static/Vector_2.png"></image>
							</view>
						</view>
					</view>
				</view>
			</van-tab>
		</van-tabs>


		<!-- 签到弹窗 -->
		<view class="sign-box" v-if="isSignShow">
			<view class="sign-mask-bg"></view>
			<view class="sign-main">
				<view class="year-text">{{currentYear}}</view>
				<view class="sign-header">
					<view class="sign-header-title">每日签到</view>
					<view class="sign-days">已连续签到{{signNum}}天</view>
				</view>

				<view class="sign-detail-main">
					<view class="sign-item" :class="{'signed': item.isSignIn == 1}" v-for="(item, index) in signList"
						:key="index">
						<view class="sign-item-top" v-if="item.isSignIn == 0">
							<text v-if="index < 6">+20</text>
							<image v-else class="gift-img" src="../../static/sign/gift.png"></image>
						</view>
						<view class="sign-item-top" v-else>
							<van-icon class="success-icon" name="success" />
						</view>
						<view class="sign-item-bottom" v-if="index == 0">周一</view>
						<view class="sign-item-bottom" v-else-if="index == 1">周二</view>
						<view class="sign-item-bottom" v-else-if="index == 2">周三</view>
						<view class="sign-item-bottom" v-else-if="index == 3">周四</view>
						<view class="sign-item-bottom" v-else-if="index == 4">周五</view>
						<view class="sign-item-bottom" v-else-if="index == 5">周六</view>
						<view class="sign-item-bottom" v-else-if="index == 6">周日</view>
					</view>
				</view>

				<view class="sign-btn" @click.stop="handleSign">点击签到</view>

				<van-icon class="close-icon" @click.stop="isSignShow = false" name="close" />
			</view>


		</view>

	</view>
</template>

<script>
	import authModal from '@/components/auth-modal/auth-modal.vue'
	import getDateTime from '@/common/getDateTime.js'
	import apiRqs from '@/api/api-request.js'
	// import skeleton from '@/pages/workbench/skeleton/workbench-load.vue'
	import {
		log
	} from 'util'
	export default {
		components: {
			// 注册会员组件
			'auth-modal': authModal,
			// 'auth-skeleton': skeleton, // 骨架屏
		},
		data() {
			return {
				indexActive: '',
				floatingShow: true,
				isNewYearShow: false,
				indicatorDots: false,
				autoplay: true,
				interval: 3500,
				duration: 1000,
				badgeValue: 2,
				title: 'Hello',
				workMore: 'more',
				dynamicMore: 'more',
				contentText: {
					contentdown: '查看更多',
					contentrefresh: '加载中',
					contentnomore: '没有更多'
				},
				isLogin: true,
				isTodayWorkShow: false,
				isTodayWorkCompletedShow: false,
				todayDoWorkList: [],
				todayDoWorkText: '今日进行中 0',
				todayDoWorkCompletedText: '今日已完成 0',
				todayCompletedWorkList: [],
				dynamicList: [],
				workRqs: {
					'pageSize': 5,
					'pageIndex': 1,
					'orderBy': ''
				},
				dynamicRqs: {
					'pageSize': 5,
					'pageIndex': 1,
					'orderBy': ''
				},
				isWorkLoad: false,
				isDynamicLoad: false,
				todayWorkLoading: false,
				dynamicLoading: false,
				todayCompletedLoading: false,
				workListV2: [],
				todayDoWorkListOg: [],
				todayCompletedWorkListOg: [],
				isSignShow: false,
				signList: [],
				signNum: 0,
				currentYear: 0,
				reqNums: 3,

				tabsTaskList: [], // 今日任务工作台任务类型
				tabsTaskInfoList: [], // 六大任务数
				userInfoToken: {}, // 存储解析后的token信息
				skeletonLoading: false, // 骨架屏加载
			}
		},

		// 页面加载时
		async onShow() {
			uni.removeStorageSync('isImageView')
			await this.handleIsRegistered() // 验证是否注册小程序 & 解析token并缓存

			this.handleGetWeekSignList() // 周签到 
			this.geTecruitTasksList() // 获取工作台招揽任务
		},

		// 页面显示时
		async onLoad(options) {
			let currentYear = getDateTime.getDay(0).split('-')[0]
			this.currentYear = currentYear
			this.handleIsRegistered();
			// this.handleGetWorkListV2();
			this.handleAnalysisToken();
			// this.handleIsMerchant();
		},

		computed: {
			// 获取当前日期
			currentDate() {
				const date = new Date();
				const year = date.getFullYear();
				const month = date.getMonth() + 1;
				const day = date.getDate();
				return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
			},
		},

		methods: {
			// 新年祝福
			handleGoNewYear() {
				uni.navigateTo({
					url: '/packageC/new-year/custom-new-year'
				})
			},
			handleWork(index) {
				uni.setStorageSync('doWorkInfo', this.todayDoWorkListOg[index])
				uni.navigateTo({
					url: '/packageA/workbench/detail'
				})
			},
			handleWorkCompleted(index) {
				uni.setStorageSync('doWorkCompletedInfo', this.todayCompletedWorkListOg[index])
				uni.navigateTo({
					url: '/packageA/workbench/completed-detail'
				})
			},

			/**
			 * @function 获取工作台招揽任务
			 */
			async geTecruitTasksList() {
				try {
					// this.skeletonLoading = true // 骨架屏
					const personLiable = uni.getStorageSync('tokenInfo')
					let reqData = {
						dateRange: {
							beginDate: this.currentDate,
							endDate: this.currentDate,
						},
						personLiable: personLiable.realName ? personLiable.realName : "",
						type: '',
						finish: 99,
						way: '电话',
					}
					console.log('工作台招揽任务请求发送前的参数', reqData)
					const taskRes = await apiRqs._getRecruitmentTaskService(reqData)
					console.log('工作台招揽任务返回的结果', taskRes)
					if (taskRes.code == 200) {
						// 重新组合成新数据
						let tableList = []
						for (let i = 0; i < taskRes.data.length; i++) {
							let objArray = [{
									name: '任务数',
									value: taskRes.data[i].recruitTaskSum
								},
								{
									name: '已完成',
									value: taskRes.data[i].completedToday
								},
								{
									name: '成功',
									value: taskRes.data[i].finish
								},
								{
									name: '继续',
									value: taskRes.data[i].continue
								},
								{
									name: '战败',
									value: taskRes.data[i].giveUp
								},
								{
									name: '未完成',
									value: taskRes.data[i].notCompletedToday
								},
							]
							tableList.push(objArray)
						}

						this.tabsTaskList = taskRes.data
						this.tabsTaskInfoList = tableList
						console.log('进行赋值后招揽任务', this.tabsTaskList)
						console.log('任务数数据', this.tabsTaskInfoList)
					}
				} catch (error) {
					console.log('获取工作台招揽任务失败')
				}
			},

			// 点击任务数跳转页面
			goPageLink(scopeRow) {
				console.log('页面名称', scopeRow.type)
				if (scopeRow.type === '预约促进') {
					console.log('预约促进')
				} else if (scopeRow.type === '活动促进') {
					console.log('活动促进');
				} else if (scopeRow === '自定义导入' || scopeRow.type === '自定义导入' || scopeRow.type === '优惠券到期招揽') {
					uni.navigateTo({
						// 保留当前页面，跳转到应用内的其他页面
						url: '/packageE/maintenance-task/customImport'
					})
				} else if (scopeRow === 'APP提醒') {
					uni.navigateTo({
						url: '/packageE/appPages/appIndex'
					})
				} else {
					console.log('其他类型-跳转常规招揽');
					uni.navigateTo({
						url: '/packageE/maintenance-task/db-maintenance-task'
					})
				}
			},

			// 获取职位列表
			async getRoleList(tokenInfo) {
				await apiRqs._getRoleList(tokenInfo.shopId).then(res => {
					console.log('职位列表', res)
					uni.setStorageSync('roleList', res.data)
				}).catch(err => {
					console.log('request err', err)
				})
			},
			// 获取v2任务列表
			handleGetWorkListV2() {
				apiRqs._getWorkListV2().then(res => {
					console.log('v2任务列表', res)
					if (res.code == 200) {
						let data = res.data.data
						this.workListV2 = data
					}
				})
			},
			// 点击积分轮播图
			handleIntegral() {
				getApp().showToast('积分兑礼快马加鞭开发中,丰厚大奖兑换敬请期待!')
			},
			// 获取工作任务-今日进行中
			async handleTodayWorkList() {
				var that = this
				await apiRqs._getWorkDoList(that.workRqs).then(res => {
					that.isWorkLoad = true
					console.log('工作任务今日进行中', res)
					if (res.code == 200) {
						const tokenInfo = uni.getStorageSync('tokenInfo')
						that.getRoleList(tokenInfo)
						let workLoadingData = JSON.parse(JSON.stringify(res.data.data))
						for (let i = 0; i < workLoadingData.length; i++) {
							if (workLoadingData[i].class.length > 7) {
								workLoadingData[i].class = workLoadingData[i].class.substring(0, 7) + '...'
							}
						}
						uni.hideLoading()
						that.todayDoWorkList = workLoadingData
						that.todayDoWorkListOg = res.data.data
						that.todayDoWorkText = '今日进行中 ' + res.data.totalRecords
						if (res.data.totalRecords > 0) {
							that.isTodayWorkShow = true
						} else {
							that.isTodayWorkShow = false
						}

						if (that.workRqs.pageSize >= res.data.totalRecords) {
							that.workMore = 'noMore'
						} else {
							that.workMore = 'more'
						}
					} else {
						if (res.code == 401 && that.reqNums > 0) {
							that.reqNums = that.reqNums - 1
							that.handleIsRegistered(that.registeredCallBack)
						} else if (res.code == 2 && that.reqNums > 0) {
							that.reqNums = that.reqNums - 1
							that.handleIsRegistered(that.registeredCallBack)
						} else if (res.code == 400 && that.reqNums > 0) {
							that.reqNums = that.reqNums - 1
							that.handleIsRegistered(that.registeredCallBack)
						} else if (res.code == undefined && that.reqNums > 0) {
							that.reqNums = that.reqNums - 1
							that.handleIsRegistered(that.registeredCallBack)
						} else {
							uni.hideLoading()
							that.isTodayWorkShow = false
							getApp().showToast(res.msg)
						}
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 获取工作任务-今日已完成
			async handleTodayCompletedWorkList() {
				var that = this
				let rqs = {
					'pageSize': 9999,
					'pageIndex': 1,
					'orderBy': ''
				}
				await apiRqs._getWorkCompletedList(rqs).then(res => {
					console.log('工作任务今日已完成', res)
					if (res.code == 200) {
						let workDoneData = JSON.parse(JSON.stringify(res.data.data))
						for (let i = 0; i < workDoneData.length; i++) {
							if (workDoneData[i].class.length > 7) {
								workDoneData[i].class = workDoneData[i].class.substring(0, 7) + '...'
							}
						}
						that.todayCompletedWorkList = workDoneData
						that.todayCompletedWorkListOg = res.data.data
						that.todayDoWorkCompletedText = '今日已完成 ' + res.data.data.length

						if (res.data.totalRecords > 0) {
							that.isTodayWorkCompletedShow = true
						} else {
							that.isTodayWorkCompletedShow = false
						}
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 获取工作动态列表
			async handleDynamicList() {
				var that = this
				await apiRqs._getDynamicList(that.dynamicRqs).then(res => {
					console.log('工作动态', res)
					if (res.code == 200) {
						let newData = JSON.parse(JSON.stringify(res.data.data))
						for (let i = 0; i < newData.length; i++) {
							newData[i].operation = newData[i].typeRemark.substring(0, 2)
						}
						that.dynamicList = newData
						if (res.data.totalRecords > 0) {
							that.isDynamicLoad = true
						} else {
							that.isDynamicLoad = false
						}

						if (that.dynamicRqs.pageSize >= res.data.totalRecords) {
							that.dynamicMore = 'noMore'
						} else {
							that.dynamicMore = 'more'
						}
					}
				}).catch(err => {
					console.log(err)
				})
			},
			// 验证是否注册小程序
			handleIsRegistered(cb) {
				var that = this
				// getApp().showLoading();
				uni.login({
					provider: 'weixin',
					success(loginRes) {
						console.log(loginRes)
						let code = loginRes.code
						uni.request({
							url: 'https://bydapi.vaubang.cn/api/v1/WxOpen/Login?code=' +
								code,
							method: 'post',
							header: {
								'content-type': 'application/json;charset=utf-8;'
							},
							success(res) {
								// uni.hideLoading();
								console.log('登陆信息', res)
								// 当登录者已经绑定了openid时，直接保存登录信息返回的token以及公司信息
								if (res.data.code == 200) {
									uni.setStorageSync('isLogin', true)
									uni.setStorageSync('loginInfo', res.data
										.data)
									getApp().globalData.loginInfo = res.data
										.data
									that.isLogin = true
									let loginInfo = res.data.data
									if (loginInfo && loginInfo.token) {
										uni.request({
											url: 'https://bydapi.vaubang.cn/api/v1/WxOpen/GetTokenInfo',
											method: 'post',
											header: {
												'content-type': 'application/json;charset=utf-8;',
												'Authorization': 'Bearer ' + loginInfo.token
											},
											success(res) {
												console.log('解析token', res.data)

												if (res.data.code == 200 && res.data.data !=
													null) {
													uni.setStorageSync('tokenInfo', res.data.data)
													that.getRoleList(res.data.data)
												}
											},
											fail(err) {
												console.log(err)
											}
										})
									}
									if (cb) {
										cb()
									}

								} else if (res.data.code == 210) {
									uni.hideLoading()
									// that.todayWorkLoading = false;
									uni.setStorageSync('isLogin', false)
									uni.setStorageSync('userData', res.data.data)
									that.isLogin = false
									uni.navigateTo({
										url: '/packageA/bind/bind'
									})
								} else {
									// that.todayWorkLoading = false;
									uni.hideLoading()
									getApp().showToast(res.data.msg)
								}
							},
							fail(err) {
								console.log(err)
							}
						})
					}
				})
			},
			registeredCallBack() {
				console.log('-------------401授权到期后重新加载任务、动态-------------')
				this.handleTodayWorkList()
				this.handleTodayCompletedWorkList()
				this.handleDynamicList()
				this.handleGetWeekSignList()
			},
			// 解析token
			handleAnalysisToken() {
				var that = this
				const loginInfo = uni.getStorageSync('loginInfo')
				if (loginInfo && loginInfo.token) {
					uni.request({
						url: 'https://bydapi.vaubang.cn/api/v1/WxOpen/GetTokenInfo',
						method: 'post',
						header: {
							'content-type': 'application/json;charset=utf-8;',
							'Authorization': 'Bearer ' + loginInfo.token
						},
						success(res) {
							console.log('解析token', res.data.data)
							if (res.data.code == 200 && res.data.data != null) {
								uni.setStorageSync('tokenInfo', res.data.data)
							}
						},
						fail(err) {
							console.log(err)
						}
					})
				}
			},
			// 今日进行中任务加载更多
			handleWorkLoadMore(e) {
				if (e.detail.status != 'noMore') {
					this.workRqs.pageSize = this.workRqs.pageSize + 5
					this.handleTodayWorkList()
				}
			},
			// 动态加载更多
			handleDynamicLoadMore(e) {
				if (e.detail.status != 'noMore') {
					this.dynamicRqs.pageSize = this.dynamicRqs.pageSize + 5
					var that = this

					getApp().showLoading()
					apiRqs._getDynamicList(that.dynamicRqs).then(res => {
						uni.hideLoading()
						console.log('工作动态', res)
						if (res.code == 200) {
							that.dynamicList = res.data.data
							if (res.data.totalPages == that.dynamicRqs.pageIndex) {
								that.dynamicMore = 'noMore'
							}
						} else {
							getApp().showToast(res.msg)
						}
					}).catch(err => {
						console.log(err)
					})
				}
			},
			// 进入报名入口
			handleApplyList(title) {
				if (title == 'training') {
					uni.navigateTo({
						url: '/packageA/workbench/apply-list?type=training'
					})
				} else {
					uni.navigateTo({
						url: '/packageA/workbench/apply-list'
					})
				}

			},
			// 进入专题专项报名入口
			handleSubjectList() {
				uni.navigateTo({
					url: '/packageA/workbench/subject-list'
				})
			},
			// 进入积分抽奖入口
			goLottery() {
				uni.navigateTo({
					url: '/packageA/workbench/integral-lottery'
				})
			},
			// 进入定制新年祝福
			goCustomNewYear() {
				uni.navigateTo({
					url: '/packageC/new-year/custom-new-year'
				})
			},
			// 立即签到
			handleSign() {
				var that = this
				getApp().showLoading()
				apiRqs._handleSign().then(res => {
					uni.hideLoading()
					console.log('今日签到结果', res)
					if (res.code == 200) {
						getApp().showToast('签到成功')
						that.isSignShow = false

						// 显示新年弹窗
						// that.isNewYearShow = true;
					} else {
						getApp().showToast(res.msg)
					}
				})
			},
			// 获取本周签到情况
			handleGetWeekSignList() {
				let currentDay = getDateTime.getDay(0)
				apiRqs._getCurrentWeekSignDetail().then(res => {
					console.log('本周签到情况', res)
					if (res.code == 200) {
						let newData = JSON.parse(JSON.stringify(res.data))
						let signNum = 0
						for (let i = 0; i < newData.length; i++) {
							newData[i].signDay =
								`${newData[i].signInDate.split('-')[1]}-${newData[i].signInDate.split('-')[2]}`
							if (newData[i].isSignIn == 1) {
								signNum++
							}
							if (currentDay == newData[i].signInDate) {
								newData[i].isCurrentDay = true
								if (newData[i].isSignIn == 0) {
									this.isSignShow = true
								} else {
									this.isSignShow = false
								}
							}
						}
						this.signNum = signNum
						this.signList = newData
					}
				})
			},
			// 功能跳转
			handleFunctionUrl(url) {
				if (url === 'product') {
					uni.navigateTo({
						url: '/packageA/workbench/product-marketing'
					})
				} else if (url === 'xubao') {
					uni.setStorageSync('wxType', 'xubao')
					uni.navigateTo({
						url: '/packageA/workbench/xubao'
					})
				} else if (url === 'dingbao') {
					uni.setStorageSync('wxType', 'dingbao')
					uni.navigateTo({
						url: '/packageA/workbench/xubao'
					})
				} else if (url === 'coupon') {
					uni.navigateTo({
						url: '/packageD/coupon/coupon'
					})
				}
			},
			// 功能暂未开放
			handleFunctionTip() {
				getApp().showToast('功能暂未开放,敬请期待!')
			},
			// 分享给好友
			onShareAppMessage() {
				return this.getShareData()
			},
			getShareData() {
				let title = '邀请您使用派尔云BI'
				let imageUrl = 'https://biapi.vaubang.cn/UploadFiles/Images/replace/index-share-2.png'
				let path = '/pages/workbench/workbench'
				return {
					title,
					imageUrl,
					path,
				}
			},
			onPullDownRefresh() {
				console.log('refresh')
				this.handleIsRegistered(this.registeredCallBack)
				setTimeout(function() {
					uni.stopPullDownRefresh()
				}, 2000)
			},

			// 跳转至日常任务-默认app提醒页
			goHandleTask() {
				console.log("点击了日常任务")
				uni.navigateTo({
					// 保留当前页面，跳转到应用内的其他页面
					url: '/packageE/maintenance-task/db-maintenance-task'
				})
			},
			// 自定义任务页面跳转
			handleGoImportPath() {
				uni.navigateTo({
					// 保留当前页面，跳转到应用内的其他页面
					url: '/packageE/maintenance-task/customImport'
				})
			},
			// 跳转预约看板
			handleGoAboutSee() {
				uni.navigateTo({
					// 保留当前页面，跳转到应用内的其他页面
					url: '/packageE/activity-task/reserved-list-v2'
				})
			},
			// 跳转历史招揽记录
			handleGoWxReecord() {
				uni.navigateTo({
					url: '/packageE/maintenance-task/wx-record'
				})
			}

		}
	}
</script>

<style lang="less">
	page {
		background-color: #FAFAFA;
	}

	.workbench {
		.new-year-modal {
			position: fixed;
			top: 0;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 99;

			.mask-bg {
				position: absolute;
				top: 0;
				bottom: 0;
				left: 0;
				right: 0;
				z-index: 100;
				background-color: #000;
				opacity: 0.2;
			}

			.new-year-modal-img {
				width: 80%;
				position: absolute;
				left: 10%;
				top: 50%;
				margin-top: -60%;
				z-index: 101;
			}

			.close-icon {
				font-size: 48rpx;
				color: rgba(255, 255, 255, 1);
				position: absolute;
				top: 74%;
				left: 50%;
				margin-left: -24rpx;
				z-index: 101;
			}
		}

		.van-tabs__scroll {
			background-color: transparent;
		}

		.lottery-box {
			position: fixed;
			right: 10px;
			bottom: 50px;
			box-sizing: border-box;
			z-index: 99;
			animation: doudong 5s ease-in-out infinite;
			animation-direction: alternate;

			.lottery-img {
				width: 60px;
			}
		}

		.floating-w {
			position: fixed;
			right: 5px;
			bottom: 180px;
			z-index: 99;
			width: 80px;
			height: 67px;
			transition: all 0.5s linear;
		}

		.floating-h {
			position: fixed;
			right: 2px;
			bottom: 160px;
			width: 45px;
			height: 140px;
			transition: all 0.5s linear;
			z-index: 99;
		}

		.nav-function-box {
			display: flex;
			flex-wrap: wrap;
			// justify-content: space-between;

			// width: calc(100% - 32px);
			width: 100%;
			background-color: #fff;
			// border-radius: 8px;
			padding: 24rpx 24rpx 16rpx 24rpx;
			display: flex;
			align-items: center;
			box-sizing: border-box;
			// margin: 15px 16px 0 16px;
			margin: 24rpx 0px;
			box-shadow: 4px 0px 20px rgba(0, 0, 0, 0.05);

			.nav-function-item {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				margin-right: 24rpx;
				margin-bottom: 24rpx;
				width: 120rpx;

				&:nth-child(5n) {
					margin-right: 0;
				}

				.nav-icon-box {
					width: 36px;
					height: 36px;
					border-radius: 50%;
					background-size: 100%;
					background-repeat: no-repeat;

					&.bg0 {
						background-image: url("../../static/edit_8.png");
					}

					&.bg3 {
						background-image: url("../../static/edit_9.png");
					}

					&.bg4 {
						background-color: #DC624E;
					}

					&.bg5 {
						background-image: url("../../static/edit_1.png");
					}

					&.bg6 {
						background-image: url("../../static/edit_2.png");
					}

					&.bg7 {
						background-image: url("../../static/edit_3.png");
					}

					&.bg8 {
						background-image: url("../../static/edit_4.png");
					}

					&.bg9 {
						background-image: url("../../static/edit_5.png");
					}

					&.bg10 {
						background-image: url("../../static/edit_6.png");
					}

					&.bg11 {
						background-image: url("../../static/edit_7.png");
					}

					&.bg12 {
						background-image: url("../../static/edit_10.png");
					}

					.nav-icon {
						font-size: 22px;
						color: #fff;
					}
				}

				.nav-item-text {
					font-size: 24rpx;
					color: #666;
					margin-top: 12rpx;
				}
			}
		}

		.header-swiper {
			width: 100%;
			height: 150px;

			.swiper {
				height: 150px !important;
			}

			.swiper-image {
				width: 100%;
				height: 150px;
			}
		}

		.van-tabs {
			margin-top: 5px;

			.work-classify-list {
				margin: 10px 16px 0 16px;
				display: flex;
				flex-wrap: wrap;
				justify-content: flex-start;

				.work-classify-item {
					width: calc((100% - 6px) / 3);
					min-width: calc((100% - 6px) / 3);
					max-width: calc((100% - 6px) / 3);
					padding: 20px 0;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					background-color: #fff;
					border-right: 2px solid #f5f5f5;

					&:nth-child(3n) {
						border-right: none;
					}

					&:nth-child(n+3) {
						border-top: 2px solid #f5f5f5;
					}

					.work-classify-text {
						font-size: 12px;
						color: rgba(0, 0, 0, 0.8);
						margin-top: 5px;
					}

					.icon-badge {
						width: 30px;
						height: 30px;
						background-size: 100%;
						background-repeat: no-repeat;
					}
				}
			}

			.work-list {
				margin: 0 16px;

				.no-work-list-tip {
					display: flex;
					align-items: center;
					flex-direction: column;
					font-size: 14px;
					color: #999;
					margin: 40px 0;
				}

				.uni-load-more {
					margin-top: 10px;
				}

				.work-item {
					display: flex;
					align-items: center;
					background-color: #fff;
					padding: 15px 20px;
					margin-top: 15px;
					border-radius: 8px;
					box-shadow: 4px 0px 20px rgba(0, 0, 0, 0.05);
					box-sizing: border-box;

					&:active {
						background-color: #f1f1f1;
					}

					.work-item-icon {
						width: 38px;
						height: 38px;
						flex: 0 0 38px;
						border-radius: 4px;
						display: flex;
						align-items: center;
						justify-content: center;
						background-color: #93d5dc;

						.label-icon {
							font-size: 22px;
							color: #fff;
							font-weight: 500;
						}
					}

					.work-item-content {
						flex: 1;
						margin-left: 15px;
						display: flex;
						flex-direction: column;

						.work-item-title {
							font-size: 13px;
							color: #222;
						}

						.work-item-detail-type {
							width: 100%;
							display: flex;
							align-items: center;
							margin-top: 3px;

							.work-item-detail-text {
								font-size: 12px;
								color: rgba(0, 0, 0, 0.3);
							}
						}
					}
				}
			}

			.completed-list {
				margin: 0 16px;

				.no-work-list-tip {
					display: flex;
					align-items: center;
					flex-direction: column;
					font-size: 14px;
					color: #999;
					margin: 40px 0;
				}

				.work-item {
					display: flex;
					align-items: center;
					background-color: #fff;
					padding: 15px 20px;
					margin-top: 15px;
					border-radius: 8px;
					box-shadow: 4px 0px 20px rgba(0, 0, 0, 0.05);
					box-sizing: border-box;

					&:active {
						background-color: #f1f1f1;
					}

					.work-item-icon {
						width: 38px;
						height: 38px;
						flex: 0 0 38px;
						border-radius: 4px;
						display: flex;
						align-items: center;
						justify-content: center;
						background-color: #93d5dc;

						.label-icon {
							font-size: 22px;
							color: #fff;
							font-weight: 500;
						}
					}

					.work-item-content {
						flex: 1;
						margin-left: 15px;
						display: flex;
						flex-direction: column;

						.work-item-title {
							font-size: 13px;
							color: #222;
						}

						.work-item-detail-type {
							width: 100%;
							display: flex;
							align-items: center;
							margin-top: 3px;

							.work-item-detail-text {
								font-size: 12px;
								color: rgba(0, 0, 0, 0.3);
							}
						}
					}
				}
			}

			.dynamic-list {

				margin-top: 10px;

				.dynamic-list-text {
					font-size: 12px;
					color: #999999;
					margin: 0 20px;
				}

				.uni-load-more {
					margin-top: 10px;
					margin-bottom: 10px;
				}

				.dynamic-list-content {
					margin: 10px 16px 0 16px;

					.dynamic-item {
						padding: 15px 20px;
						box-sizing: border-box;
						border-radius: 8px;
						margin-top: 15px;
						background-color: #fff;
						box-shadow: 4px 0px 20px rgba(0, 0, 0, 0.05);
						display: flex;
						align-items: center;

						&:first-child {
							margin-top: 10px;
						}

						.work-item-icon {
							width: 38px;
							flex: 0 0 38px;
							height: 38px;
							border-radius: 4px;

							display: flex;
							align-items: center;
							justify-content: center;

							&.work-item-icon-bg1 {
								background-color: #fecc11;
							}

							&.work-item-icon-bg2 {
								background-color: #f7d78c;
							}

							&.work-item-icon-bg3 {
								background-color: #afc3a8;
							}

							&.work-item-icon-bg4 {
								background-color: #ff5844;
							}

							.label-icon {
								font-size: 22px;
								color: #fff;
								font-weight: 500;
							}
						}

						.dynamic-item-content {
							flex: 1;
							margin-left: 15px;

							.dynamic-item-date-person {
								display: flex;
								align-items: center;
								justify-content: space-between;

								.dynamic-item-date,
								.dynamic-item-person {
									font-size: 12px;
									color: #666;
								}
							}

							.dynamic-item-icon-text {
								margin-top: 5px;

								.dynamic-item-text {
									font-size: 12px;
									color: #999;
								}
							}
						}

					}
				}
			}
		}

		.sign-box {
			position: fixed;
			top: 0;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 50;

			.sign-mask-bg {
				position: absolute;
				top: 0;
				bottom: 0;
				left: 0;
				right: 0;
				background: rgba(0, 0, 0, 0.5);
				z-index: 51;
			}

			.sign-main {
				position: absolute;
				top: 100rpx;
				left: 50%;
				margin-left: -274rpx;
				background-image: url("https://biapi.vaubang.cn/UploadFiles/Images/replace/sign-bg.png");
				background-size: 100%;
				background-repeat: no-repeat;
				width: 550rpx;
				height: 868rpx;
				border-radius: 40rpx;
				z-index: 52;

				.close-icon {
					font-size: 48rpx;
					color: rgba(255, 255, 255, 0.5);
					position: absolute;
					bottom: -80rpx;
					left: 50%;
					margin-left: -24rpx;
					z-index: 60;
				}

				.year-text {
					position: absolute;
					top: 120rpx;
					left: 190rpx;
					font-size: 24rpx;
					color: rgba(0, 0, 0, 0.9);
					transform: rotate(-14deg);
					font-weight: 600;
				}

				.sign-header {
					position: absolute;
					top: 228rpx;
					width: 100%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;

					.sign-header-title {
						font-size: 32rpx;
						color: #FFFFFF;
						font-weight: 500;
					}

					.sign-days {
						font-size: 20rpx;
						color: #fff;
						padding: 5px 10px;
						background-color: #FFD156;
						border-radius: 80rpx;
						margin-top: 20rpx;
					}
				}

				.sign-detail-main {
					position: absolute;
					top: 406rpx;
					left: 40rpx;
					right: 40rpx;
					display: flex;
					flex-wrap: wrap;
					justify-content: center;

					.sign-item {
						display: flex;
						flex-direction: column;
						justify-content: center;
						align-items: center;
						margin: 6px 5px 6px 5px;

						.sign-item-top {
							width: 70rpx;
							height: 70rpx;
							border-radius: 50%;
							background-color: #fff;
							box-shadow: 0 0 2px #008aff;
							color: #888;
							font-size: 24rpx;
							display: flex;
							align-items: center;
							justify-content: center;

							.gift-img {
								width: 44rpx;
								height: 44rpx;
								animation: doudong 2s ease-in-out infinite;
								animation-direction: alternate;
							}
						}

						.sign-item-bottom {
							font-size: 24rpx;
							color: #333;
							margin-top: 8px;
							font-weight: 500;
						}

						&.signed {
							.sign-item-top {
								background-color: #008aff;
								color: #fff;
								font-size: 32rpx;
							}
						}
					}

					.sign-detail-day-item {
						width: 48px;
						background: linear-gradient(180deg, #FFFFFF 0%, #DCF0FF 100%);
						display: flex;
						flex-direction: column;
						align-items: center;
						justify-content: center;
						border-radius: 4px;
						padding: 5px;
						margin: 0 5px;
						box-sizing: border-box;
						margin-top: 6px;

						&.current-day {
							border: 2px solid #DCF0FF;
						}

						.integral {
							font-size: 10px;
							color: rgba(0, 0, 0, 0.5);
						}

						.sign-selected-icon {
							width: 22px;
							height: 22px;
							margin-top: 3px;
						}

						.day-text {
							font-size: 10px;
							font-weight: 500;
							color: rgba(0, 138, 255, 0.5);
							margin-top: 3px;
						}
					}
				}

				.sign-btn {
					position: absolute;
					bottom: 20px;
					left: 44px;
					right: 44px;
					height: 40px;
					line-height: 40px;
					text-align: center;
					background-color: #008aff;
					color: #fff;
					border-radius: 4px;
				}
			}


		}

		/** tabs栏样式 */
		.task_tabs {
			.van-tabs--line {
				background-color: #fff;

				.van-sticky {
					.van-sticky-wrap {
						background-color: #fff;

						.van-tabs__scroll--line {
							.van-tabs__nav--line {

								// tabs选中时的底部横线
								.van-tabs__line {
									width: 16px !important;
									background-color: #FF0000 !important;
								}

								// tabs未选中时的字体样式
								.van-tab {
									color: #666666 !important;
									font-size: 14px !important;
									font-weight: 400 !important;
								}

								// tabs选中时的字体样式
								.van-tab--active {
									color: #333333 !important;
									font-size: 14px !important;
									font-weight: 600 !important;
								}
							}
						}
					}
				}

				.task_detail,
				.import_detail,
				.about_detail {
					display: flex;
					flex-direction: column;
					padding: 24rpx 32rpx 32rpx 32rpx;

					.task_number_item {
						display: flex;
						justify-content: space-between;
						align-items: center;
						margin-bottom: 16rpx;
						padding: 18rpx 32rpx;
						border-radius: 8rpx;
						background: linear-gradient(#FFF6F6 100%, #FFF6F6 40%);

						.number_item_left {
							display: flex;
							align-items: center;

							.left_img {
								display: flex;
								justify-content: center;
								align-items: center;
								width: 20rpx;
								height: 20rpx;

								.ellipse_image {
									width: 100%;
									height: 100%;
								}
							}

							.left_text {
								margin-left: 10rpx;
								font-size: 28rpx;
								color: #333333;
							}
						}

						.number_item_right {
							display: flex;
							align-items: center;

							.right_text {
								margin-right: 10rpx;
								font-size: 28rpx;
								font-weight: 500;
								color: #333333;
							}

							.right_text_color {
								color: #FF4A4A;
							}

							.right_img {
								display: flex;
								align-items: center;
								justify-content: center;
								width: 10rpx;
								height: 20rpx;

								.vector_image {
									width: 100%;
									height: 100%;
								}
							}
						}

						&:last-child {
							margin-bottom: 0;
						}
					}
				}
			}
		}
	}

	@keyframes doudong {
		0% {
			transform: scale(1);
			transform: rotate(-8deg);
			/*开始为原始大小*/
		}

		25% {
			transform: scale(1.08);
			transform: rotate(8deg);
			/*放大1.1倍*/
		}

		50% {
			transform: scale(1);
			transform: rotate(-8deg);
		}

		75% {
			transform: scale(1.08);
			transform: rotate(8deg);
		}
	}
</style>